package com.example.demo.Config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

@EnableWebMvc
@Configuration
public class SwaggerConfig {
    @Bean
    public Docket appApi(){
        return new Docket(DocumentationType.SWAGGER_2)
                .enable(true)
//                .groupName("faker")
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.example.demo.Controller"))
//                .paths(PathSelectors.any())
                .build()
                .apiInfo(appInfo());
    }
    private ApiInfo appInfo() {
        return new ApiInfoBuilder().title("接口管理")
                .contact(new Contact("作者", "个人地址", "本人邮箱"))
                .version("v1.0")
                .description("某系统说明")
                .build();
    }
}